package com.xu.book.service.impl;

import com.xu.book.bean.Book;
import com.xu.book.dao.IBookDao;
import com.xu.book.dao.impl.BookDaoimpl;
import com.xu.book.service.IBookService;
import com.xu.sys.utils.PageUtils;
import java.util.List;

public class BookServiceimpl implements IBookService {
    private IBookDao dao = new BookDaoimpl();
    @Override
    public void listPage(PageUtils pageUtils) {
        List<Book> books = dao.listPage(pageUtils);
        int count = dao.count(pageUtils);
        pageUtils.setList(books);
        pageUtils.setTotalCount(count);
    }

    @Override
    public int count(PageUtils pageUtils) {
        return dao.count(pageUtils);
    }

    @Override
    public List<Book> list(Book book) {
        return dao.list(book);
    }

    @Override
    public int save(Book entity) {
        return dao.save(entity);
    }

    @Override
    public Book findById(int id) {
        return dao.findById(id);
    }

    @Override
    public int updateById(Book entity) {
        return dao.updateById(entity);
    }

    @Override
    public int deleteById(int id) {
        return dao.deleteById(id);
    }
}
